1
2
3
4
5 package ui;
6
7 import java.awt.*;
8 import java.awt.event.*;
9
10 /***
11 * This class listens for Mouse and Mouse Motion events and silently consumes them.
12 * When the mouse is pressed it issues a Toolkit.beep.
13 *
14 * @author Barrie Treloar
15 */
16 public class BeepOnMouseEvents
17 implements MouseListener,
18 MouseMotionListener
19 {
20 /***
21 * Invoked when the mouse has been clicked on a component.
22 */
23 public void mouseClicked(MouseEvent e)
24 {
25 }
26
27 /***
28 * Invoked when a mouse button has been pressed on a component.
29 */
30 public void mousePressed(MouseEvent e)
31 {
32 Toolkit.getDefaultToolkit().beep();
33 }
34
35 /***
36 * Invoked when a mouse button has been released on a component.
37 */
38 public void mouseReleased(MouseEvent e)
39 {
40 }
41
42 /***
43 * Invoked when the mouse enters a component.
44 */
45 public void mouseEntered(MouseEvent e)
46 {
47 }
48
49 /***
50 * Invoked when the mouse exits a component.
51 */
52 public void mouseExited(MouseEvent e)
53 {
54 }
55
56 /***
57 * Invoked when a mouse button is pressed on a component and then
58 * dragged. Mouse drag events will continue to be delivered to
59 * the component where the first originated until the mouse button is
60 * released (regardless of whether the mouse position is within the
61 * bounds of the component).
62 */
63 public void mouseDragged(MouseEvent e)
64 {
65 }
66
67 /***
68 * Invoked when the mouse button has been moved on a component
69 * (with no buttons no down).
70 */
71 public void mouseMoved(MouseEvent e)
72 {
73 }
74 }